package com.eber.demo.design.adapter;

public class AdapterObject {
    public static void main(String[] args) {
        Adaptee adaptee = new Adaptee();
        Target target = new Adapter(adaptee);
        target.request();
    }

    private static class Adaptee {
        public void doSomething() {
            System.out.println("我做了一件事情...");
        }
    }

    private interface Target {
        void request();
    }

    private static class Adapter implements Target {
        private final Adaptee adaptee;

        Adapter(Adaptee adaptee) {
            this.adaptee = adaptee;
        }

        @Override
        public void request() {
            System.out.println("适配处理...");
            adaptee.doSomething();
        }
    }
}
